package com.bjpowernode.crm.commons.utils;

import org.apache.poi.hssf.usermodel.HSSFCell;

/**
 * 上传Excel表的工具类方法
 */
public class HSSFUtils {
    /**
     * 从指定的HSSFCell对象中获取列的值
     * @return
     */
    public static String getCellValueForStr(HSSFCell cell) {
        String ret = "";
        if (cell.getCellType() == HSSFCell.CELL_TYPE_STRING) {//字符型
            ret = cell.getStringCellValue();
        } else if (cell.getCellType() == HSSFCell.CELL_TYPE_NUMERIC) {//数值型
            ret = cell.getNumericCellValue() + "";
        } else if (cell.getCellType() == HSSFCell.CELL_TYPE_FORMULA) {//公式型
            ret = cell.getCellFormula();
        } else if (cell.getCellType() == HSSFCell.CELL_TYPE_BOOLEAN) {//boolean型
            ret = cell.getBooleanCellValue() + "";
        }else {
            ret ="";
        }
        return ret;
    }
}
